package org.nice.controller;

import org.nice.vo.User;
import org.nice.vo.Users;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.Arrays;

@Controller
@RequestMapping("/user")
public class GetDataTypeController {

    @RequestMapping("path1")
    public String getValue1() {
        System.out.println("这里是path1...");
        System.out.println("Bye...");
        return "HelloSpringMVC";
    }

    @RequestMapping("path2")
    public String getValue2(User user) {
        System.out.println("这里是path2...");
        System.out.println(user);
        System.out.println("Bye...");
        return "HelloSpringMVC";
    }

    @RequestMapping("path3")
    public String getValue3(Users users) {
        System.out.println("这里是path3...");
        System.out.println("爱好..." + Arrays.toString(users.getHobby()));
        System.out.println("用户名字..." + users.getUsers());
        System.out.println("身份..." + users.getIdentity());
        System.out.println("Bye...");
        return "HelloSpringMVC";
    }

    @RequestMapping(path = "path4", method = {RequestMethod.POST, RequestMethod.GET}, params = {"names", "age"}, headers = "token")
    public String getValue4() {
        System.out.println("这里是path4...");

        System.out.println("Bye...");
        return "HelloSpringMVC";
    }
}
